/**
 * 多维数组生成，二维为例
 *
 *
 */
class mutiArray {
  constructor (m, n){
    this.item = new Array(m)
    for(let i = 0; i < m; i++ ){
      this.item[i] = new Array(n)
    }
    return this.item    
  } 
}
/*
const mutiarray = new mutiArray(4, 5)

console.log(mutiarray)
*/

/**
 * 单向链表
 * 
 */
class Linklist {
  constructor(element){
    this.value = element
    this.next = null
    this.pre = null  
  }
  
  insert(node) {
    try {
      node.next = this.next
      node.pre = this
      this.next = node
      return this
    } catch (err) {
      console.log(err)
    }
  }
  
  remove(node) {
    try {
     this.next = node.next
     node.next.pre = this
     return this
    } catch (err) {
      console.log(err)
    }

  } 
}

const list1 = new Linklist(1)

list1.insert(new Linklist(2)).insert(new Linklist(3)).insert(new Linklist(4)).insert(new Linklist(5))
console.log(list1.next.next)
